<%@ page import="com.psl.model.halfproduct" %>
<%@ page import="com.psl.model.supplier" %>
<%@ page import="com.psl.services.work.list.SupplierServices" %>
<%@ page import="com.psl.services.work.list.halfProductServices" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<form name="selectticketno" action="/halfproductprint.do" method="post" target="_blank">
        <select name="h_area" onchange="ticketno(this,this.form.h_ticketno)">
            <option value="">请选择供应商</option>
            <% SupplierServices ss = new SupplierServices();
                List su = ss.selectsupplier();
                Iterator iter10 = su.iterator();
                supplier sup = null;
                while (iter10.hasNext()) {
                    sup = (supplier) iter10.next();
            %>
            <option value="<%=sup.getSp_id()%>"><%=sup.getSp_name()%>
            </option>
            <%}%>
        </select>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <select name="h_ticketno">
            <option value="0">选择凭条编码</option>
        </select>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="打印">
</form>
<script>
    tickets = {};
    <% for(int i=1;i<=50;i++){
        halfProductServices hps6=new halfProductServices();
        List hp6=hps6.ptlist(i);
        Iterator iter6=hp6.iterator();
        halfproduct hpt6=null;%>
    tickets['<%=i%>'] = new Array(<%while (iter6.hasNext()){hpt6=(halfproduct)iter6.next();%>'<%=hpt6.getH_ticketno()%>', <%}%>);
    <%}%>
    function ticketno(h_area, h_ticketno) {
        var pv, cv;
        var i, ii;

        pv = h_area.value;
        cv = h_ticketno.value;

        h_ticketno.length = 1;

        if (pv == '0') return;
        if (typeof(tickets[pv]) == 'undefined') return;

        for (i = 0; i < tickets[pv].length; i++) {
            ii = i + 1;
            h_ticketno.options[ii] = new Option();
            h_ticketno.options[ii].text = tickets[pv][i];
            h_ticketno.options[ii].value = tickets[pv][i];
        }

    }
</script>

